import shutil
import os

def copy_files(source_dir, destination_dir, filenames):
    """
    将指定文件从源目录复制到目标目录。

    Args:
        source_dir: 源目录路径。
        destination_dir: 目标目录路径。
        filenames: 要复制的文件名列表。
    """

    # 确保目标目录存在
    if not os.path.exists(destination_dir):
        os.makedirs(destination_dir)

    for filename in filenames:
        source_path = os.path.join(source_dir, filename)
        destination_path = os.path.join(destination_dir, filename)

        try:
            shutil.copy2(source_path, destination_path)  # 使用copy2保留文件元数据
            print(f"文件 '{filename}' 已成功复制到 '{destination_dir}'。")
        except FileNotFoundError:
            print(f"文件 '{filename}' 在源目录中未找到。")
        except Exception as e:
            print(f"复制文件 '{filename}' 时发生错误: {e}")

if __name__ == "__main__":
    source_directory = "F:\\Program Files (x86)\\Steam\\steamapps\\common\\OxygenNotIncluded\\OxygenNotIncluded_Data\\Managed\\"  # 替换为你的源目录
    destination_directory = "./"  # 替换为你的目标目录

    files_to_copy = [
        "0Harmony.dll",
        "Assembly-CSharp-firstpass.dll",
        "FMODUnityResonance.dll",
        "UnityEngine.CoreModule.dll",
        "UnityEngine.UI.dll",
        "Assembly-CSharp.dll",
        "FMODUnity.dll",
        "Newtonsoft.Json.dll",
        "UnityEngine.dll"
    ]

    copy_files(source_directory, destination_directory, files_to_copy)